package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.DpSpBean;
import com.lwj.liwanjia.impl.DpSpView;
import com.lwj.liwanjia.model.DpSpModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/11.
 */

public class DpSpPresenter {
    private DpSpView dpSpView;
    private DpSpModel dpSpModel;

    public DpSpPresenter(DpSpView dpSpView) {
        this.dpSpView = dpSpView;
        dpSpModel = new DpSpModel();
    }

    public void getDpSpData(Map<String, Object> map) {
        if (dpSpView != null) {
            dpSpModel.getDpSpData(map, new Subscriber<DpSpBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    dpSpView.showError((Exception) e);
                }

                @Override
                public void onNext(DpSpBean dpSpBean) {
                    dpSpView.getDpSpData(dpSpBean);
                }
            });
        }
    }
}
